home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / Samples / Moofwars 1.02 / MoofWars Sprocket / Read Me First < prev   
Encoding:
Text File  |  1998-08-10  |  6.2 KB  |  113 lines  |  [TEXT/R*ch]

  1. MoofWars 1.02 (8/10/98)
  2. =======================
  3.  
  4. Written by Timothy Carroll
  5. timc@apple.com
  6.  
  7. Copyright © 1996, 1997, 1998 Apple Computer, Inc., All Rights Reserved
  8.  
  9.  
  10. You may incorporate this sample code into your applications without restriction, though the sample code has been provided "AS IS" and the responsibility for its operation is 100% yours.  However, what you are not permitted to do is to redistribute the source as "DSC Sample Code" after having made changes. If you're going to re-distribute the source, we require that you make it clear in the source that the code was descended from Apple Sample Code, but that you've made changes.
  11.  
  12.  
  13. Version History
  14. ===============
  15.  
  16. 1.02 -- This fixes a few bugs in the code.  In addition, the VBL task has been replaced with a Time Manager task.
  17.  
  18. 1.01 -- This version is a little friendlier to compilers other than Metrowerks.  In my final days of cleaning up 1.0, I broke compilation on MrC or Motorola.  Send me email if you can't get it to build on those compilers.
  19.  
  20. A few disposal bugs were found using Onyx's Spotlight, and these have been fixed.
  21.  
  22. Added a couple of lines to the blitter code to try to catch an invalid case that should never happen, but could if we pass an improperly encoded sprite.  Check out TGraphic for details.
  23.  
  24. 1.0 -- original release.  Thanks to George Warner for providing me the DogCow sprite graphics.
  25.  
  26.  
  27. MAKE SURE MACSBUG IS INSTALLED!
  28. ===============================
  29.  
  30. By default, I compile with debugging code added to the project, so make sure you have MacsBug installed!
  31.  
  32.  
  33. What is it?
  34. ===========
  35.  
  36. MoofWars is a DrawSprocket games sample that shows a few techniques for fast drawing of sprites as well as a scrolling, tiled background.  With about 1400 sprites on the screen, this code can achieve 15 frames per second on a 7100/66 and 30+ frames on an 8500/120.  Thanks to DrawSprocket, it takes full advantage of page flipping -- with less sprites on the screen, an 8500 with full video RAM can achieve 66 frames per second with full screen 640x480 animation.
  37.  
  38. If you have the Tips of the Mac Games Gurus book, you can add the Hollywood API and sound resources to the game -- by default, all of the sound calls are conditionalized so that this API is not required.  I definitely recommend the book as a good place to get started on writing Macintosh games.
  39.  
  40. This code builds under both MrC and the Metrowerks Compilers.  I haven't tested it in the Motorola compilers recently, but I don't forsee any major problems there either.  This version requires DrawSprocket, so it is currently PowerPC only.
  41.  
  42. Descriptions of the Files
  43. =========================
  44.  
  45. Moofwars.cp
  46. -----------
  47. This is the core application that initializes all the mac stuff, loads the game data, and runs the game.  The corresponding header file, Moofwars.h, holds all of the conditional compilation codes for the game.  The game code supports full error checking -- the debugging version of the code will debugstr if it encounters an error, while the standard version will probably just quit the application.
  48.  
  49. TCommandTimer.cp
  50. ----------
  51. The keystrokes are obtained in a time manager task.  Previous versions used a VBL, but I'm starting to change things to be more Carbon friendly. 
  52.  
  53. TGraphic.cp and TGraphicCollection.cp
  54. -----------     ---------------------
  55. A generic class that handles blitting a graphic into a PixMap.  The current routines are partially based of the run-length encoded sprites in the game programming gurus books, with considerable optimizations made to improve speed.  This is a complete class that handles all of the encoding, loading of the graphics and drawing.  The current code requires an 8-bit pixmap, but if new encoders were written, the blitter loops would work fine for 16 and 32 bit sprites as well.  TGraphic also provides complete hit testing code for RLE graphics.
  56.  
  57. The TGraphicCollection is a simple collection class for a set of TGraphics.
  58.  
  59. TSprite.cp
  60. ----------
  61. A standard sprite class to handle processing sprites, including drawing
  62. and hit testing.  Leverages heavily off of the TGraphic classes.
  63.  
  64. TSpriteCollection.cp
  65. --------------------
  66. A collection of related sprites.  Generally, the games never all the
  67. sprite routines directly, but instead call a collection object which
  68. iterates over an entire list.
  69.  
  70. TShipSprite.cp, TEnemySprite.cp, TShotSprite.cp
  71. -----------------------------------------------
  72. Derived classes from TSprite that show how to create behaviors for a particular class of sprite.
  73.  
  74. TTileCollection.cp
  75. ------------------
  76.  
  77. Much like the TSpriteCollection and TGraphicCollection, this holds an entire set of 32x32 tiles that can be drawn to the screen.  Unlike those classes, there is no separate TTile class to handle this drawing -- all of the work is handled inside the collection class.  I did this to minimize call-chain overhead.
  78.  
  79. TTileGrid.cp
  80. ------------
  81.  
  82. A class that describes a 2 dimensional array of tiles that can be drawn as the background for the window.  This version only supports drawing the tiles, but hit testing and more complex logic shouldn't be difficult to add.
  83.  
  84.  
  85. Sprite Encoding Tools
  86. ---------------------
  87. Because the sprites and tiles are usually encoded before adding them to the project, I'm also including my current versions of my encoder tools that I use to generate the sprites.  These projects are not as extensively tested as the rest of the MoofWars code, but should provide some insight into how to build the various resources.
  88.  
  89.  
  90.  
  91. Future Development
  92. ==================
  93.  
  94. Some things I may try to add in the future include:
  95.  
  96. *  Improved performance of the sprite and tile blitters
  97. *  Fixing a couple of ugly pieces of code (Scaling.cp sucks!)
  98. *  NetSprocket support
  99. *  Actual interface code, such as a "loading game" dialog and preferences.
  100. *  Actual displays for keeping score
  101. *  Computer opponents.
  102.  
  103.  
  104. If you have other features you'd rather see, let me know and (time permitting), I'll try to add them.
  105.  
  106.  
  107. Feedback
  108. ========
  109.  
  110. I've tried to make this code bug-free, easy to understand, and most importantly, FAST!  So if the code fails in any of these areas, please drop me a line and tell me exactly what you ran into.  For bugs, ideally, let me know if it stops on a debug-assert and why.
  111.  
  112. In particular, if you come up with ways to speed up this code further, I'd love to hear them.
  113.